package com.tanhua.mangement.service;

import cn.hutool.core.convert.Convert;
import cn.hutool.core.date.DateTime;
import cn.hutool.core.date.DateUnit;
import cn.hutool.core.util.StrUtil;
import com.alibaba.dubbo.common.utils.CollectionUtils;
import com.alibaba.dubbo.config.annotation.Reference;
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.tanhua.common.enums.AreaEnum;
import com.tanhua.common.enums.SexEnum;
import com.tanhua.common.enums.TitleEnum;
import com.tanhua.common.mapper.UserInfoMapper;
import com.tanhua.common.pojo.UserInfo;
import com.tanhua.dubbo.server.api.DashboardApi;
import com.tanhua.dubbo.server.pojo.Index;
import com.tanhua.dubbo.server.pojo.Managelogs;
import com.tanhua.mangement.vo.*;
import lombok.extern.slf4j.Slf4j;
import org.apache.commons.lang3.StringUtils;
import org.springframework.beans.factory.annotation.Autowired;
import cn.hutool.core.collection.CollUtil;
import cn.hutool.core.date.DateUtil;
import cn.hutool.core.util.ObjectUtil;
import com.tanhua.common.mapper.UserMapper;
import com.tanhua.common.pojo.User;
import org.springframework.data.mongodb.core.query.Criteria;
import org.springframework.data.mongodb.core.query.Query;
import org.springframework.stereotype.Service;
import com.tanhua.common.enums.AgeRangeEnum;

import java.util.*;

import java.util.ArrayList;
import java.util.Date;
import java.util.List;
import java.util.Map;
import java.util.stream.Collectors;

@Service
@Slf4j
public class DashboardService {
    @Autowired
    private UserInfoMapper userInfoMapper;

    @Autowired
    private UserMapper userMapper;

    @Reference(version = "1.0.0")
    private DashboardApi dashboardApi;

    /**
     * 注册用户分布
     *
     * @param startTime
     * @param endTime
     * @return
     */
    public DistributionVo distribution(Long startTime, Long endTime) {
        /*long stTime = startTime.getTime();
        long edTime = endTime.getTime();*/
        DistributionVo distributionVo = new DistributionVo();//创建返回对象
        //根据时间查询所有数据,然后封装数据
        QueryWrapper queryWrapper = new QueryWrapper();
        List<UserInfo> userInfoList = this.userInfoMapper.selectList(queryWrapper);
        List<UserInfo> userInfos = new ArrayList<>();
        for (UserInfo userInfo : userInfoList) {
            //将起始时间和结束时间中的活跃用户添加到userInfos
            if (userInfo.getCreated().getTime() > startTime && userInfo.getCreated().getTime() < endTime) {
                userInfos.add(userInfo);
            }
        }
        if (CollectionUtils.isEmpty(userInfos)) {
            return distributionVo;
        }

        //年龄分布
        Index index = new Index();
        //List<Integer> ageList= userInfos.stream().map(UserInfo::getAge).collect(Collectors.toList());
        List<Integer> ageList = new ArrayList<>();
        for (UserInfo userInfo : userInfos) {
            //从用户信息表中获取年龄,放入年龄集合中
            ageList.add(userInfo.getAge());
        }
        if (CollectionUtils.isNotEmpty(ageList)) {
            //封装数据
            List<ReturnDataVo> age = new ArrayList<>();
            //统计
            for (Integer integer : ageList) {
                if (integer >= AgeRangeEnum.UNDERAGE.getMin() && integer <= AgeRangeEnum.UNDERAGE.getMax()) {
                    index.underAge++;

                } else if (integer >= AgeRangeEnum.JUVENILE.getMin() && integer <= AgeRangeEnum.JUVENILE.getMax()) {
                    index.juvenile++;
                } else if (integer >= AgeRangeEnum.TEENAGER.getMin() && integer <= AgeRangeEnum.TEENAGER.getMax()) {
                    index.teenager++;
                } else if (integer >= AgeRangeEnum.YOUTH.getMin() && integer <= AgeRangeEnum.YOUTH.getMax()) {
                    index.youth++;
                } else if (integer >= AgeRangeEnum.MIDDLEAGE.getMin() && integer <= AgeRangeEnum.MIDDLEAGE.getMax()) {
                    index.middleAge++;
                } else if (integer >= AgeRangeEnum.AGEDNESS.getMin() && integer <= AgeRangeEnum.AGEDNESS.getMax()) {
                    index.agedness++;
                }
            }
            Map<AgeRangeEnum, Integer> ageDistribution = new HashMap<>();
            ageDistribution.put(AgeRangeEnum.UNDERAGE, index.underAge);
            ageDistribution.put(AgeRangeEnum.JUVENILE, index.juvenile);
            ageDistribution.put(AgeRangeEnum.TEENAGER, index.teenager);
            ageDistribution.put(AgeRangeEnum.YOUTH, index.youth);
            ageDistribution.put(AgeRangeEnum.MIDDLEAGE, index.middleAge);
            ageDistribution.put(AgeRangeEnum.AGEDNESS, index.agedness);
            Set<AgeRangeEnum> ageRangeEnums = ageDistribution.keySet();
            for (AgeRangeEnum ageRangeEnum : ageRangeEnums) {
                Integer integer = ageDistribution.get(ageRangeEnum);
                ReturnDataVo returnDataVo = new ReturnDataVo();
                returnDataVo.setTitle(ageRangeEnum.getDesc());
                returnDataVo.setAmount(integer);
                age.add(returnDataVo);
            }
            distributionVo.setAgeDistribution(age);
        }

        //性别分布
        List<SexEnum> sexEnumList = new ArrayList<>();
        for (UserInfo userInfo : userInfos) {
            //获取性别
            sexEnumList.add(userInfo.getSex());
        }
        if (CollectionUtils.isNotEmpty(sexEnumList)) {
            int manCount = 0;//默认初始值
            int womanCount = 0;
            for (SexEnum sexEnum : sexEnumList) {
                if (sexEnum.name().equalsIgnoreCase("man")) {
                    manCount++;
                } else {
                    womanCount++;
                }
            }
            List<ReturnDataVo> gender = new ArrayList<>();
            Map<String, Integer> sexDistribution = new HashMap<>();
            sexDistribution.put("男性用户", manCount);
            sexDistribution.put("女性用户", womanCount);
            Set<String> ageRangeEnums = sexDistribution.keySet();
            for (String string : ageRangeEnums) {
                Integer integer = sexDistribution.get(string);
                ReturnDataVo returnDataVo = new ReturnDataVo();
                returnDataVo.setTitle(string.equals("男性用户") ? TitleEnum.MAN.getValue() : TitleEnum.WOMAN.getValue());
                returnDataVo.setAmount(integer);
                gender.add(returnDataVo);
            }
            distributionVo.setGenderDistribution(gender);
        }

        //区域分布
        List<String> regionalLists = new ArrayList<>();
        for (UserInfo userInfo : userInfos) {
            regionalLists.add(userInfo.getCity());
        }
        if (CollectionUtils.isNotEmpty(regionalLists)) {
            List<String> regionalList = new ArrayList<>();
            for (String regional : regionalLists) {
                String before = StringUtils.substringBefore(regional, "-");
                regionalList.add(before);
            }
            List<ReturnDataVo> local = new ArrayList<>();
            Map<AreaEnum, Integer> regionalMap = new HashMap<>();
            for (String regional : regionalList) {
                switch (regional.substring(0, 2)) {
                    case "湖北":
                        index.hubei++;
                        index.huazhong++;
                        break;
                    case "湖南":
                        index.hunan++;
                        index.huazhong++;
                        break;
                    case "河南":
                        index.henan++;
                        index.huazhong++;
                        break;
                    case "山西":
                        index.shanxi1++;
                        index.huabei++;
                        break;
                    case "河北":
                        index.hebei++;
                        index.huabei++;
                        break;
                    case "北京":
                        index.beijing++;
                        index.huabei++;
                        break;
                    case "天津":
                        index.tianjing++;
                        index.huabei++;
                        break;
                    case "内蒙":
                        index.neimenggu++;
                        index.huabei++;
                        break;
                    case "浙江":
                        index.zhejiang++;
                        index.huadong++;
                        break;
                    case "安徽":
                        index.anhui++;
                        index.huadong++;
                        break;
                    case "上海":
                        index.sahnghai++;
                        index.huadong++;
                        break;
                    case "江西":
                        index.jiangxi++;
                        index.huadong++;
                        break;
                    case "山东":
                        index.shandong++;
                        index.huadong++;
                        break;
                    case "江苏":
                        index.jiangshu++;
                        index.huadong++;
                        break;
                    case "福建":
                        index.fujian++;
                        index.huadong++;
                        break;
                    case "台湾":
                        index.taiwan++;
                        index.huadong++;
                        break;
                    case "广西":
                        index.gaungxi++;
                        index.huanan++;
                        break;
                    case "广东":
                        index.gaungdong++;
                        index.huanan++;
                        break;
                    case "海南":
                        index.hainan++;
                        index.huanan++;
                        break;
                    case "香港":
                        index.xianggang++;
                        index.huanan++;
                        break;
                    case "澳门":
                        index.aomen++;
                        index.huanan++;
                        break;
                    case "青海":
                        index.qinghai++;
                        index.xibei++;
                        break;
                    case "宁夏":
                        index.ningxia++;
                        index.xibei++;
                        break;
                    case "陕西":
                        index.shanxi++;
                        index.xibei++;
                        break;
                    case "甘肃":
                        index.ganshu++;
                        index.xibei++;
                        break;
                    case "新疆":
                        index.xinjiang++;
                        index.xibei++;
                        break;
                    case "吉林":
                        index.jilin++;
                        index.dongbei++;
                        break;
                    case "黑龙":
                        index.heilongjiang++;
                        index.dongbei++;
                        break;
                    case "辽宁":
                        index.liaoning++;
                        index.dongbei++;
                        break;
                    case "贵州":
                        index.guizhou++;
                        index.xinan++;
                        break;
                    case "云南":
                        index.yunnan++;
                        index.xinan++;
                        break;
                    case "重庆":
                        index.chongqing++;
                        index.xinan++;
                        break;
                    case "四川":
                        index.sichuang++;
                        index.xinan++;
                        break;
                    case "西藏":
                        index.xizang++;
                        index.xinan++;
                        break;
                }
            }
            regionalMap.put(AreaEnum.HUBEI, index.hubei);
            regionalMap.put(AreaEnum.HUNAN, index.hunan);
            regionalMap.put(AreaEnum.HENAN, index.henan);
            regionalMap.put(AreaEnum.SHANXI, index.shanxi1);
            regionalMap.put(AreaEnum.HEBEI, index.hebei);
            regionalMap.put(AreaEnum.BEIJING, index.beijing);
            regionalMap.put(AreaEnum.TIANJIN, index.tianjing);
            regionalMap.put(AreaEnum.NEIMENGGU, index.neimenggu);
            regionalMap.put(AreaEnum.ZHEJIANG, index.zhejiang);
            regionalMap.put(AreaEnum.ANHUI, index.anhui);
            regionalMap.put(AreaEnum.SHANGHAI, index.sahnghai);
            regionalMap.put(AreaEnum.JIANGXI, index.jiangxi);
            regionalMap.put(AreaEnum.SHANDONG, index.shandong);
            regionalMap.put(AreaEnum.JIANGSU, index.jiangshu);
            regionalMap.put(AreaEnum.FUJIAN, index.fujian);
            regionalMap.put(AreaEnum.TAIWAN, index.taiwan);
            regionalMap.put(AreaEnum.GUANGXI, index.gaungxi);
            regionalMap.put(AreaEnum.GUANGDONG, index.gaungdong);
            regionalMap.put(AreaEnum.HAINAN, index.hainan);
            regionalMap.put(AreaEnum.HONGKONG, index.xianggang);
            regionalMap.put(AreaEnum.MACAO, index.aomen);
            regionalMap.put(AreaEnum.QINGHAI, index.qinghai);
            regionalMap.put(AreaEnum.NINGXIA, index.ningxia);
            regionalMap.put(AreaEnum.SHANXI2, index.shanxi);
            regionalMap.put(AreaEnum.GANSU, index.ganshu);
            regionalMap.put(AreaEnum.XINJIANG, index.xinjiang);
            regionalMap.put(AreaEnum.JILIN, index.jilin);
            regionalMap.put(AreaEnum.HEILONGJIANG, index.heilongjiang);
            regionalMap.put(AreaEnum.LIAONING, index.liaoning);
            regionalMap.put(AreaEnum.GUIZHOU, index.guizhou);
            regionalMap.put(AreaEnum.YUNNAN, index.yunnan);
            regionalMap.put(AreaEnum.CHONGQING, index.chongqing);
            regionalMap.put(AreaEnum.SICHUAN, index.sichuang);
            regionalMap.put(AreaEnum.TIBET, index.xizang);

            Set<AreaEnum> areaEnums = regionalMap.keySet();//获取key
            for (AreaEnum areaEnum : areaEnums) {
                Integer integer = regionalMap.get(areaEnum);//获取值
                ReturnDataVo returnDataVo = new ReturnDataVo();
                returnDataVo.setTitle(areaEnum.getProvince());
                returnDataVo.setAmount(integer);
                local.add(returnDataVo);
            }
            distributionVo.setLocalDistribution(local);

            //区域汇总
            List<ReturnDataVo> mapList = new ArrayList<>();
            Map<String, Integer> localTotal = new HashMap<>();
            localTotal.put(AreaEnum.HUAZHONG.getProvince(), index.huazhong);
            localTotal.put(AreaEnum.HUANBEI.getProvince(), index.huabei);
            localTotal.put(AreaEnum.HUADONG.getProvince(), index.huadong);
            localTotal.put(AreaEnum.HUANAN.getProvince(), index.huanan);
            localTotal.put(AreaEnum.XIBEI.getProvince(), index.xibei);
            localTotal.put(AreaEnum.DONGBEI.getProvince(), index.dongbei);
            localTotal.put(AreaEnum.XINAN.getProvince(), index.xinan);
            Set<String> strings = localTotal.keySet();//获取key
            for (String s : strings) {
                Integer integer = localTotal.get(s);
                ReturnDataVo returnDataVo = new ReturnDataVo();
                returnDataVo.setTitle(s);
                returnDataVo.setAmount(integer);
                mapList.add(returnDataVo);
            }
            distributionVo.setLocalTotal(mapList);
        }

        //行业分布
        List<String> industrys = new ArrayList<>();
        for (UserInfo userInfo : userInfos) {
            industrys.add(userInfo.getIndustry());
        }
        if (CollectionUtils.isNotEmpty(industrys)) {
            List<ReturnDataVo> industryList = new ArrayList<>();
            Map<String, Integer> industryMap = new HashMap<>();
            for (String industry : industrys) {//获取每一个职业
                if (industryMap.containsKey(industry)) {//判断map中是否包含key
                    Integer integer = industryMap.get(industry);//包含则取值加1
                    int i = integer + 1;
                    industryMap.put(industry, i);
                } else {
                    industryMap.put(industry, 1);
                }
            }
            Set<String> strings = industryMap.keySet();
            for (String string : strings) {
                Integer integer = industryMap.get(string);
                ReturnDataVo returnDataVo = new ReturnDataVo();
                returnDataVo.setTitle(string);
                returnDataVo.setAmount(integer);
                industryList.add(returnDataVo);
            }

            //根据行业人数排序
            industryList.sort((o1, o2) -> {
                Integer name1 = (int) o1.getAmount();
                Integer name2 = (int) o2.getAmount();
                return name2.compareTo(name1);
            });
            //页面显示行业人数排行集合
            List<ReturnDataVo> map = new ArrayList<>();
            //超过10个就只取10个,不足10个就取集合中的所有
            int min = Math.min(10, industryList.size());
            for (int i = 0; i < min; i++) {
                map.add(industryList.get(i));
            }
            distributionVo.setIndustryDistribution(map);
        }
        return distributionVo;
    }


    /**
     * 概要统计信息
     *
     * @return
     */
    public SummaryVo summary() {

        //当前时间,结果:2021-09-17 09:38:12
        Date date = DateUtil.date();
        //当天的开始时间，结果：2021-09-17 00:00:00
        Date beginOfDay = DateUtil.beginOfDay(date);
        //昨日时间,结果:2021-09-16 10:32:52
        Date yesterDay = DateUtil.yesterday();
        //昨日一天的开始，结果：2021-09-16 00:00:00
        Date yesterOfDay = DateUtil.beginOfDay(yesterDay);
        //昨日一天的结束，结果：2017-03-01 2021-09-16 23:59:59
        Date yesterEndOfDay = DateUtil.endOfDay(yesterDay);
        //两天前的时间
        Date twoDaysEarlier = DateUtil.offsetDay(date, -3);
        //两天前的开始，结果：2021-09-16 00:00:00
        Date beforeYesterOfDay = DateUtil.beginOfDay(twoDaysEarlier);
        //两天前的结束，结果：2021-09-16 23:59:59
        Date beforeYesterEndOfDay = DateUtil.endOfDay(twoDaysEarlier);


        //创建返回对象
        SummaryVo summaryVo = new SummaryVo();

        //1.累计用户
        QueryWrapper<User> wrapper1 = new QueryWrapper<>();
        List<User> users1 = this.userMapper.selectList(wrapper1);
        if (CollUtil.isNotEmpty(users1)) {
            summaryVo.setCumulativeUsers(users1.size());
        }

        //2.过去30天活跃用户
        //将当前日期向前偏移
        Date oldTime = DateUtil.offsetDay(date, -30);
        //当查询出的时间在当前时间的毫秒值以及前30天的毫秒值之间时获取出用户日志集合
        //Query query = Query.query(Criteria.where("logTime").gte(oldDate).lte(nowDate));
        List<Managelogs> managelogsList2 = this.dashboardApi.getManagelogsList(oldTime.getTime(), date.getTime());
        //List<Managelogs> managelogsList = this.mongoTemplate.find(query, Managelogs.class);
        //通过set集合的不可重复填入获取的用户id
        Set<Long> userIds2 = new HashSet<>();
        for (Managelogs managelogs : managelogsList2) {
            userIds2.add(managelogs.getUserId());
        }
        //通过获取set集合的长度即可获得用户的数量
        summaryVo.setActivePassMonth(userIds2.size());

        //3.过去7天活跃用户
        oldTime = DateUtil.offsetDay(date, -7);
        //当查询出的时间在当前时间的毫秒值以及前30天的毫秒值之间时获取出用户日志集合
        List<Managelogs> managelogsList3 = this.dashboardApi.getManagelogsList(oldTime.getTime(), date.getTime());
        //通过set集合的不可重复填入获取的用户id
        Set<Long> userIds3 = new HashSet<>();
        for (Managelogs managelogs : managelogsList3) {
            userIds3.add(managelogs.getUserId());
        }
        summaryVo.setActivePassWeek(userIds3.size());

        //4.今日新增用户
        QueryWrapper<User> wrapper4 = new QueryWrapper<>();
        wrapper4.between("created", beginOfDay, date);
        List<User> users4 = this.userMapper.selectList(wrapper4);
        if (CollUtil.isNotEmpty(users4)) {
            summaryVo.setNewUsersToday(users4.size());
        }

        //5.今日新增用户涨跌率，单位百分数，正数为涨，负数为跌
        QueryWrapper<User> wrapper5 = new QueryWrapper<>();
        wrapper5.between("created", yesterOfDay, yesterEndOfDay);
        List<User> users5 = this.userMapper.selectList(wrapper5);
        //获得涨跌率
        Integer ratio5 = this.ratio(users4.size(), users5.size());
        summaryVo.setNewUsersTodayRate(ratio5);

        //6.今日登录次数
        List<Managelogs> managelogsList6 = this.dashboardApi.getManagelogsList(beginOfDay.getTime(), date.getTime());
        summaryVo.setLoginTimesToday(managelogsList6.size());

        //7.今日登录次数涨跌率，单位百分数，正数为涨，负数为跌
        List<Managelogs> managelogsList7 = this.dashboardApi.getManagelogsList(yesterOfDay.getTime(), yesterEndOfDay.getTime());
        int yesterSize = managelogsList7.size();
        Integer ratio7 = this.ratio(summaryVo.getLoginTimesToday(), yesterSize);
        summaryVo.setLoginTimesTodayRate(ratio7);

        //8.今日活跃用户;
        Integer activeCount = this.dashboardApi.activeUsersCount(beginOfDay.getTime(), date.getTime());
        summaryVo.setActiveUsersToday(activeCount);

        //9.今日活跃用户涨跌率，单位百分数，正数为涨，负数为跌
        Integer yesterActiveCount = this.dashboardApi.activeUsersCount(yesterOfDay.getTime(), yesterEndOfDay.getTime());
        Integer ratio9 = this.ratio(activeCount, yesterActiveCount);
        summaryVo.setActiveUsersTodayRate(ratio9);

        //10.过去7天平均日使用时长，单位秒
        summaryVo.setUseTimePassWeek(369);

        //11.昨日活跃用户
        summaryVo.setActiveUsersYesterday(yesterActiveCount);

        //12.昨日活跃用户涨跌率，单位百分数，正数为涨，负数为跌
        Integer beforeYesterActiveCount = this.dashboardApi.activeUsersCount(beforeYesterOfDay.getTime(), beforeYesterEndOfDay.getTime());
        Integer ratio12 = this.ratio(yesterActiveCount, beforeYesterActiveCount);
        summaryVo.setActiveUsersYesterdayRate(ratio12);

        return summaryVo;
    }

    /**
     * 计算涨跌率:涨跌幅＝涨跌值／昨收盘＊100％
     *
     * @param newUsersToday  今日新增人数
     * @param lastUsersToday 昨日新增人数
     * @return
     */
    private Integer ratio(Integer newUsersToday, Integer lastUsersToday) {
        if (newUsersToday == 0 && lastUsersToday == 0 || newUsersToday == lastUsersToday) {
            return 0;
        } else if (newUsersToday == 0) {
            return -(lastUsersToday * 100);
        } else if (lastUsersToday == 0) {
            return newUsersToday * 100;
        } else if (newUsersToday < lastUsersToday) {
            return Convert.toInt((double) (newUsersToday - lastUsersToday) / (double) lastUsersToday * 100);
        } else {
            return ((newUsersToday - lastUsersToday) / lastUsersToday * 100);
        }
    }

    /**
     * 新增、活跃用户、次日留存率
     *
     * @param sd   开始时间
     * @param ed   结束时间
     * @param type 101 新增 102 活跃用户 103 次日留存率
     * @return
     */
    public UsersVo users(Long sd, Long ed, String type) {
        //sd = "2019-01-01";
        //ed = "2020-01-01";
        //本年 2019-01-01 00:00:00   2020-01-01 00:00:00
        Date startTime = DateUtil.date(sd);    //当前的开始时间
        Date endTime = DateUtil.date(ed);      //当前的结束时间
        //去年  2018-01-01 00:00:00   2019-01-01 00:00:00
        Date lastStartTime = DateUtil.offsetMonth(startTime, -12);    //一年前的开始时间
        Date lastEndTime = DateUtil.offsetMonth(endTime, -12);    //一年前的开始时间


        UsersVo usersVo = new UsersVo();

        switch (type) {
            //新增用户
            case "101":
                usersVo = getAddingUserData(startTime, endTime, lastStartTime, lastEndTime);
                break;
            //活跃用户
            case "102":
                usersVo = getActiveUser(startTime, endTime, lastStartTime, lastEndTime);
                break;
            //次日留存率
            case "103":
                usersVo = getNextDayRetention(startTime, endTime, lastStartTime, lastEndTime);
                break;

            default:
                return null;
        }

        return usersVo;

    }

    /**
     * 次日留存率
     *
     * @param startTime     //当前的开始时间
     * @param endTime       //当前的结束时间
     * @param lastStartTime //一年前的开始时间
     * @param lastEndTime   //一年前的开始时间
     * @return
     */
    private UsersVo getNextDayRetention(Date startTime, Date endTime, Date lastStartTime, Date lastEndTime) {
        //创建返回对象
        UsersVo usersVo = new UsersVo();

        //时间戳之间的日志表数据
        //List<Managelogs> managelogsList = this.dashboardApi.getManagelogsList(startTime.getTime(), endTime.getTime());

        //相差的天数
        Integer day = Convert.toInt(DateUtil.between(startTime, endTime, DateUnit.DAY));

        //时间戳之间的用户注册数据
        QueryWrapper<User> wrapper = new QueryWrapper<>();
        wrapper.between("created", startTime, endTime);
        List<User> userList = this.userMapper.selectList(wrapper);

        //今年的数据
        List<DateNumberVo> thisYear = new ArrayList<>();
        for (int i = 1; i <= day + 1; i++) {
            DateNumberVo dateNumberVo = new DateNumberVo();
            Integer amount = 0;
            for (int j = 0; j < userList.size(); j++) {
                User user = userList.get(j);
                String format = DateUtil.format(startTime, "yyyy-MM-dd");
                String userFormat = DateUtil.format(user.getCreated(), "yyyy-MM-dd");
                if (StrUtil.equals(format, userFormat)) {
                    //次日留存率,时间要往后推一天
                    Date nextDay = DateUtil.offsetDay(user.getCreated(), 1);
                    //一天的开始
                    Date beginOfDay = DateUtil.beginOfDay(nextDay);
                    //一天的结束
                    Date endOfDay = DateUtil.endOfDay(nextDay);
                    //查询第二天的日志表
                    //List<Managelogs> managelogsList = this.dashboardApi.getManagelogsList(beginOfDay.getTime(), endOfDay.getTime());
                    Managelogs managelogsByUserId = this.dashboardApi.getManagelogsByUserId(beginOfDay.getTime(), endOfDay.getTime(), user.getId());
                    if (ObjectUtil.isNotEmpty(managelogsByUserId)) {
                        amount++;
                        continue;
                    }
                }
            }
            String format = DateUtil.format(startTime, "MM-dd");
            dateNumberVo.setTitle(format);
            dateNumberVo.setAmount(amount);
            thisYear.add(dateNumberVo);
            startTime = DateUtil.offsetDay(startTime, 1);
        }
        usersVo.setThisYear(thisYear);

        //时间戳之间的用户注册数据
        QueryWrapper<User> lastWrapper = new QueryWrapper<>();
        lastWrapper.between("created", lastStartTime, lastEndTime);
        List<User> lastUserList = this.userMapper.selectList(lastWrapper);

        //去年的数据
        List<DateNumberVo> lastYear = new ArrayList<>();
        for (int i = 1; i <= day + 1; i++) {
            DateNumberVo dateNumberVo = new DateNumberVo();
            Integer amount = 0;
            for (int j = 0; j < lastUserList.size(); j++) {
                User user = lastUserList.get(j);
                String format = DateUtil.format(lastStartTime, "yyyy-MM-dd");
                String userFormat = DateUtil.format(user.getCreated(), "yyyy-MM-dd");
                if (StrUtil.equals(format, userFormat)) {
                    //次日留存率,时间要往后推一天
                    Date nextDay = DateUtil.offsetDay(user.getCreated(), 1);
                    //一天的开始
                    Date beginOfDay = DateUtil.beginOfDay(nextDay);
                    //一天的结束
                    Date endOfDay = DateUtil.endOfDay(nextDay);
                    //查询第二天的日志表
                    //List<Managelogs> managelogsList = this.dashboardApi.getManagelogsList(beginOfDay.getTime(), endOfDay.getTime());
                    Managelogs managelogsByUserId = this.dashboardApi.getManagelogsByUserId(beginOfDay.getTime(), endOfDay.getTime(), user.getId());
                    if (ObjectUtil.isNotEmpty(managelogsByUserId)) {
                        amount++;
                        continue;
                    }
                }
            }
            String format = DateUtil.format(lastStartTime, "MM-dd");
            dateNumberVo.setTitle(format);
            dateNumberVo.setAmount(amount);
            lastYear.add(dateNumberVo);
            lastStartTime = DateUtil.offsetDay(lastStartTime, 1);
        }
        usersVo.setLastYear(lastYear);

        return usersVo;
    }

    /**
     * 活跃用户数据
     *
     * @param startTime     //当前的开始时间
     * @param endTime       //当前的结束时间
     * @param lastStartTime //一年前的开始时间
     * @param lastEndTime   //一年前的开始时间
     * @return
     */
    private UsersVo getActiveUser(Date startTime, Date endTime, Date lastStartTime, Date lastEndTime) {
        //开始时间和结束时间相差的天数
        long betweenDay = DateUtil.between(startTime, endTime, DateUnit.DAY);
        //当前时间
        //String today = DateUtil.today();
        //获取结束时间
        //String format = DateUtil.format(endTime, "yyyy-MM-dd");
        if (betweenDay < 31) {
            return this.getActiveUserDay(startTime, endTime, lastStartTime, lastEndTime, betweenDay);
        } else {
            return this.getActiveUserCustomTime(startTime, endTime, lastStartTime, lastEndTime);
        }
    }

    /**
     * 30天内的活跃用户数据
     *
     * @param startTime     //当前的开始时间
     * @param endTime       //当前的结束时间
     * @param lastStartTime //一年前的开始时间
     * @param lastEndTime   //一年前的开始时间
     * @param day           //开始时间和结束时间相差的天数
     * @return
     */
    private UsersVo getActiveUserDay(Date startTime, Date endTime, Date lastStartTime, Date lastEndTime, long day) {
        //循环的天数
        Integer days = Convert.toInt(day) + 1;
        //创建返回对象
        UsersVo usersVo = new UsersVo();

        //今年新增用户数据
        List<Managelogs> managelogsList = this.dashboardApi.getManagelogsList(startTime.getTime(), endTime.getTime());

        List<DateNumberVo> thisYear = new ArrayList<>();
        for (int i = 1; i <= days; i++) {
            DateNumberVo dateNumberVo = new DateNumberVo();
            Integer amount = 0;

            //set集合去重
            Set<Long> userIds = new HashSet<>();
            for (Managelogs managelogs : managelogsList) {
                String dd1 = DateUtil.format(DateUtil.date(managelogs.getLogTime()), "MM-dd");
                String dd2 = DateUtil.format(startTime, "MM-dd");
                if (StrUtil.equals(dd1, dd2)) {
                    userIds.add(managelogs.getUserId());
                }
            }

            String format = DateUtil.format(startTime, "MM-dd");
            dateNumberVo.setTitle(format);
            dateNumberVo.setAmount(userIds.size());
            thisYear.add(dateNumberVo);
            startTime = DateUtil.offsetDay(startTime, 1);
        }
        usersVo.setThisYear(thisYear);

        //去年新增用户数据
        List<Managelogs> lastManagelogsList = this.dashboardApi.getManagelogsList(lastStartTime.getTime(), lastEndTime.getTime());

        //按照一周7天遍历查询,如果日期和User创建日期相同 amount+1
        List<DateNumberVo> lastYear = new ArrayList<>();
        for (int i = 1; i <= days; i++) {
            DateNumberVo dateNumberVo = new DateNumberVo();
            Integer amount = 0;

            //set集合去重
            Set<Long> userIds = new HashSet<>();
            for (Managelogs managelogs : lastManagelogsList) {
                String dd1 = DateUtil.format(DateUtil.date(managelogs.getLogTime()), "MM-dd");
                String dd2 = DateUtil.format(lastStartTime, "MM-dd");
                if (StrUtil.equals(dd1, dd2)) {
                    userIds.add(managelogs.getUserId());
                }
            }
            String format = DateUtil.format(lastStartTime, "MM-dd");
            dateNumberVo.setTitle(format);
            dateNumberVo.setAmount(userIds.size());
            lastYear.add(dateNumberVo);
            lastStartTime = DateUtil.offsetDay(lastStartTime, 1);
        }
        usersVo.setLastYear(lastYear);

        return usersVo;
    }

    /**
     * 自定义时间活跃用户数据
     *
     * @param startTime     //当前的开始时间
     * @param endTime       //当前的结束时间
     * @param lastStartTime //一年前的开始时间
     * @param lastEndTime   //一年前的开始时间
     * @return
     */
    private UsersVo getActiveUserCustomTime(Date startTime, Date endTime, Date lastStartTime, Date lastEndTime) {
        //创建返回对象
        UsersVo usersVo = new UsersVo();

        List<Managelogs> managelogsList = this.dashboardApi.getManagelogsList(startTime.getTime(), endTime.getTime());

        List<DateNumberVo> thisYear = new ArrayList<>();
        for (int i = 1; i <= 12; i++) {
            DateNumberVo dateNumberVo = new DateNumberVo();
            //set集合去重
            Set<Long> userIds = new HashSet<>();
            for (Managelogs managelogs : managelogsList) {
                //获得月份，从0开始计数 所以需要+1
                int month = DateUtil.month(DateUtil.date(managelogs.getLogTime())) + 1;
                if (i == month) {
                    userIds.add(managelogs.getUserId());
                }
            }
            dateNumberVo.setTitle(i + "月");
            dateNumberVo.setAmount(userIds.size());
            thisYear.add(dateNumberVo);
        }
        usersVo.setThisYear(thisYear);

        List<Managelogs> lastManagelogsList = this.dashboardApi.getManagelogsList(lastStartTime.getTime(), lastEndTime.getTime());

        //按照一年12个月遍历查询,如果月份和User创建月份相同 amount+1
        List<DateNumberVo> lastYear = new ArrayList<>();
        for (int i = 1; i <= 12; i++) {
            DateNumberVo dateNumberVo = new DateNumberVo();
            //set集合去重
            Set<Long> userIds = new HashSet<>();
            for (Managelogs managelogs : lastManagelogsList) {
                //获得月份，从0开始计数 所以需要+1
                int month = DateUtil.month(DateUtil.date(managelogs.getLogTime())) + 1;
                if (i == month) {
                    userIds.add(managelogs.getUserId());
                }
            }
            dateNumberVo.setTitle(i + "月");
            dateNumberVo.setAmount(userIds.size());
            lastYear.add(dateNumberVo);
        }
        usersVo.setLastYear(lastYear);

        return usersVo;
    }

    /**
     * 新增用户数据
     *
     * @param startTime     //当前的开始时间
     * @param endTime       //当前的结束时间
     * @param lastStartTime //一年前的开始时间
     * @param lastEndTime   //一年前的开始时间
     * @return
     */
    private UsersVo getAddingUserData(Date startTime, Date endTime, Date lastStartTime, Date lastEndTime) {
        //相差一个月，31天
        long betweenDay = DateUtil.between(startTime, endTime, DateUnit.DAY);
        //当前时间
        String today = DateUtil.today();
        //获取结束时间
        String format = DateUtil.format(endTime, "yyyy-MM-dd");
        if (betweenDay < 31) {
            return this.getUserDay(startTime, endTime, lastStartTime, lastEndTime, betweenDay);
        } else {
            return this.getUserCustomTime(startTime, endTime, lastStartTime, lastEndTime);
        }
    }

    /**
     * 30天内的新增用户数据
     *
     * @param startTime     //当前的开始时间
     * @param endTime       //当前的结束时间
     * @param lastStartTime //一年前的开始时间
     * @param lastEndTime   //一年前的开始时间
     * @param day           //开始时间和结束时间相差的天数
     * @return
     */
    public UsersVo getUserDay(Date startTime, Date endTime, Date lastStartTime, Date lastEndTime, long day) {
        //循环的天数
        Integer days = Convert.toInt(day) + 1;

        //创建返回对象
        UsersVo usersVo = new UsersVo();

        //今年新增用户数据
        QueryWrapper<User> wrapper = new QueryWrapper<>();
        wrapper.between("created", startTime, endTime);
        List<User> userList = this.userMapper.selectList(wrapper);

        //按照传过来的天数遍历查询,如果日期和User创建日期相同 amount+1
        List<DateNumberVo> thisYear = new ArrayList<>();
        for (int i = 1; i <= days; i++) {
            DateNumberVo dateNumberVo = new DateNumberVo();
            Integer amount = 0;
            for (User user : userList) {
                String dd1 = DateUtil.format(user.getCreated(), "MM-dd");
                String dd2 = DateUtil.format(startTime, "MM-dd");
                if (StrUtil.equals(dd1, dd2)) {
                    amount++;
                }
            }
            String format = DateUtil.format(startTime, "MM-dd");
            dateNumberVo.setTitle(format);
            dateNumberVo.setAmount(amount);
            thisYear.add(dateNumberVo);
            startTime = DateUtil.offsetDay(startTime, 1);
        }
        usersVo.setThisYear(thisYear);

        //去年新增用户数据
        QueryWrapper<User> lastWrapper = new QueryWrapper<>();
        lastWrapper.between("created", lastStartTime, lastEndTime);
        List<User> lastUserList = this.userMapper.selectList(lastWrapper);

        //按照传过来的天数遍历查询,如果日期和User创建日期相同 amount+1
        List<DateNumberVo> lastYear = new ArrayList<>();
        for (int i = 1; i <= days; i++) {
            DateNumberVo dateNumberVo = new DateNumberVo();
            Integer amount = 0;
            for (User user : lastUserList) {
                String dd1 = DateUtil.format(user.getCreated(), "MM-dd");
                String dd2 = DateUtil.format(lastStartTime, "MM-dd");
                if (StrUtil.equals(dd1, dd2)) {
                    amount++;
                }
            }
            String format = DateUtil.format(lastStartTime, "MM-dd");
            dateNumberVo.setTitle(format);
            dateNumberVo.setAmount(amount);
            lastYear.add(dateNumberVo);
            lastStartTime = DateUtil.offsetDay(lastStartTime, 1);
        }
        usersVo.setLastYear(lastYear);

        return usersVo;
    }

    /**
     * 自定义新增用户数据
     *
     * @param startTime     //当前的开始时间
     * @param endTime       //当前的结束时间
     * @param lastStartTime //一年前的开始时间
     * @param lastEndTime   //一年前的开始时间
     * @return
     */
    public UsersVo getUserCustomTime(Date startTime, Date endTime, Date lastStartTime, Date lastEndTime) {
        //创建返回对象
        UsersVo usersVo = new UsersVo();

        //今年新增用户数据
        QueryWrapper<User> wrapper = new QueryWrapper<>();
        wrapper.between("created", startTime, endTime);
        List<User> userList = this.userMapper.selectList(wrapper);

        List<DateNumberVo> thisYear = new ArrayList<>();
        for (int i = 1; i <= 12; i++) {
            DateNumberVo dateNumberVo = new DateNumberVo();

            Integer amount = 0;
            for (User user : userList) {
                //获得月份，从0开始计数 所以需要+1
                int month = DateUtil.month(user.getCreated()) + 1;
                if (i == month) {
                    amount++;
                }
            }
            dateNumberVo.setTitle(i + "月");
            dateNumberVo.setAmount(amount);
            thisYear.add(dateNumberVo);
        }
        usersVo.setThisYear(thisYear);

        //去年新增用户数据
        QueryWrapper<User> lastWrapper = new QueryWrapper<>();
        lastWrapper.between("created", lastStartTime, lastEndTime);
        List<User> lastUserList = this.userMapper.selectList(lastWrapper);

        //按照一年12个月遍历查询,如果月份和User创建月份相同 amount+1
        List<DateNumberVo> lastYear = new ArrayList<>();
        for (int i = 1; i <= 12; i++) {
            DateNumberVo dateNumberVo = new DateNumberVo();
            Integer amount = 0;
            for (User user : lastUserList) {
                //获得月份，从0开始计数 所以需要+1
                int month = DateUtil.month(user.getCreated()) + 1;
                if (i == month) {
                    amount++;
                }
            }
            dateNumberVo.setTitle(i + "月");
            dateNumberVo.setAmount(amount);
            lastYear.add(dateNumberVo);
        }
        usersVo.setLastYear(lastYear);

        return usersVo;
    }


    //以下代码是未优化的,优化为30天内的数据按天数显示,超过30天的数据按月份显示

    /**
     * 本周新增用户数据
     *
     * @param startTime     //当前的开始时间
     * @param endTime       //当前的结束时间
     * @param lastStartTime //一年前的开始时间
     * @param lastEndTime   //一年前的开始时间
     * @return
     */
    /*public UsersVo getUserWeek(Date startTime, Date endTime, Date lastStartTime, Date lastEndTime) {
        //创建返回对象
        UsersVo usersVo = new UsersVo();

        //今年新增用户数据
        QueryWrapper<User> wrapper = new QueryWrapper<>();
        wrapper.between("created", startTime, endTime);
        List<User> userList = this.userMapper.selectList(wrapper);

        List<DateNumberVo> thisYear = new ArrayList<>();
        for (int i = 1; i <= 8; i++) {
            DateNumberVo dateNumberVo = new DateNumberVo();
            Integer amount = 0;
            for (User user : userList) {
                //获得月份，从0开始计数 所以需要+1

                String dd1 = DateUtil.format(user.getCreated(), "dd");
                String dd2 = DateUtil.format(startTime, "dd");
                if (StrUtil.equals(dd1, dd2)) {
                    amount++;
                }
            }
            String format = DateUtil.format(startTime, "MM-dd");
            dateNumberVo.setTitle(format);
            dateNumberVo.setAmount(amount);
            thisYear.add(dateNumberVo);
            startTime = DateUtil.offsetDay(startTime, 1);
        }
        usersVo.setThisYear(thisYear);

        //去年新增用户数据
        QueryWrapper<User> lastWrapper = new QueryWrapper<>();
        lastWrapper.between("created", lastStartTime, lastEndTime);
        List<User> lastUserList = this.userMapper.selectList(lastWrapper);

        //按照一周7天遍历查询,如果日期和User创建日期相同 amount+1
        List<DateNumberVo> lastYear = new ArrayList<>();
        for (int i = 1; i <= 8; i++) {
            DateNumberVo dateNumberVo = new DateNumberVo();
            Integer amount = 0;
            for (User user : lastUserList) {
                //获得月份，从0开始计数 所以需要+1

                String dd1 = DateUtil.format(user.getCreated(), "dd");
                String dd2 = DateUtil.format(lastStartTime, "dd");
                if (StrUtil.equals(dd1, dd2)) {
                    amount++;
                }
            }
            String format = DateUtil.format(lastStartTime, "MM-dd");
            dateNumberVo.setTitle(format);
            dateNumberVo.setAmount(amount);
            lastYear.add(dateNumberVo);
            lastStartTime = DateUtil.offsetDay(lastStartTime, 1);
        }
        usersVo.setLastYear(lastYear);

        return usersVo;
    }*/

    /**
     * 本月新增用户数据
     *
     * @param startTime     //当前的开始时间
     * @param endTime       //当前的结束时间
     * @param lastStartTime //一年前的开始时间
     * @param lastEndTime   //一年前的开始时间
     * @return
     */
    /*public UsersVo getUserMonth(Date startTime, Date endTime, Date lastStartTime, Date lastEndTime) {
        //创建返回对象
        UsersVo usersVo = new UsersVo();

        //今年新增用户数据
        QueryWrapper<User> wrapper = new QueryWrapper<>();
        wrapper.between("created", startTime, endTime);
        List<User> userList = this.userMapper.selectList(wrapper);

        //按照一月30天遍历查询,如果月份日期和User创建的月份日期相同 amount+1
        List<DateNumberVo> thisYear = new ArrayList<>();
        for (int i = 1; i <= 31; i++) {
            DateNumberVo dateNumberVo = new DateNumberVo();
            Integer amount = 0;
            for (User user : userList) {
                String dd1 = DateUtil.format(user.getCreated(), "MM-dd");
                String dd2 = DateUtil.format(startTime, "MM-dd");
                if (StrUtil.equals(dd1, dd2)) {
                    amount++;
                }
            }
            String format = DateUtil.format(startTime, "MM-dd");
            dateNumberVo.setTitle(format);
            dateNumberVo.setAmount(amount);
            thisYear.add(dateNumberVo);
            startTime = DateUtil.offsetDay(startTime, 1);
        }
        usersVo.setThisYear(thisYear);

        //去年新增用户数据
        QueryWrapper<User> lastWrapper = new QueryWrapper<>();
        lastWrapper.between("created", lastStartTime, lastEndTime);
        List<User> lastUserList = this.userMapper.selectList(lastWrapper);
        //按照一月30天遍历查询,如果月份日期和User创建的月份日期相同 amount+1
        List<DateNumberVo> lastYear = new ArrayList<>();
        for (int i = 1; i <= 31; i++) {
            DateNumberVo dateNumberVo = new DateNumberVo();
            Integer amount = 0;
            for (User user : lastUserList) {
                String dd1 = DateUtil.format(user.getCreated(), "MM-dd");
                String dd2 = DateUtil.format(lastStartTime, "MM-dd");
                if (StrUtil.equals(dd1, dd2)) {
                    amount++;
                }
            }
            String format = DateUtil.format(lastStartTime, "MM-dd");
            dateNumberVo.setTitle(format);
            dateNumberVo.setAmount(amount);
            lastYear.add(dateNumberVo);
            lastStartTime = DateUtil.offsetDay(lastStartTime, 1);
        }
        usersVo.setLastYear(lastYear);

        return usersVo;
    }*/

    /**
     * 本周活跃用户数据
     *
     * @param startTime     //当前的开始时间
     * @param endTime       //当前的结束时间
     * @param lastStartTime //一年前的开始时间
     * @param lastEndTime   //一年前的开始时间
     * @return
     */
    /*private UsersVo getActiveUserWeek(Date startTime, Date endTime, Date lastStartTime, Date lastEndTime) {
        //创建返回对象
        UsersVo usersVo = new UsersVo();

        //今年新增用户数据
        List<Managelogs> managelogsList = this.dashboardApi.getManagelogsList(startTime.getTime(), endTime.getTime());

        List<DateNumberVo> thisYear = new ArrayList<>();
        for (int i = 1; i <= 8; i++) {
            DateNumberVo dateNumberVo = new DateNumberVo();
            Integer amount = 0;
            for (Managelogs managelogs : managelogsList) {
                String dd1 = DateUtil.format(DateUtil.date(managelogs.getLogTime()), "dd");
                String dd2 = DateUtil.format(startTime, "dd");
                if (StrUtil.equals(dd1, dd2)) {
                    amount++;
                }
            }
            String format = DateUtil.format(startTime, "MM-dd");
            dateNumberVo.setTitle(format);
            dateNumberVo.setAmount(amount);
            thisYear.add(dateNumberVo);
            startTime = DateUtil.offsetDay(startTime, 1);
        }
        usersVo.setThisYear(thisYear);

        //去年新增用户数据
        List<Managelogs> lastManagelogsList = this.dashboardApi.getManagelogsList(lastStartTime.getTime(), lastEndTime.getTime());

        //按照一周7天遍历查询,如果日期和User创建日期相同 amount+1
        List<DateNumberVo> lastYear = new ArrayList<>();
        for (int i = 1; i <= 8; i++) {
            DateNumberVo dateNumberVo = new DateNumberVo();
            Integer amount = 0;

            for (Managelogs managelogs : lastManagelogsList) {
                String dd1 = DateUtil.format(DateUtil.date(managelogs.getLogTime()), "dd");
                String dd2 = DateUtil.format(lastStartTime, "dd");
                if (StrUtil.equals(dd1, dd2)) {
                    amount++;
                }
            }
            String format = DateUtil.format(lastStartTime, "MM-dd");
            dateNumberVo.setTitle(format);
            dateNumberVo.setAmount(amount);
            lastYear.add(dateNumberVo);
            lastStartTime = DateUtil.offsetDay(lastStartTime, 1);
        }
        usersVo.setLastYear(lastYear);

        return usersVo;
    }*/

    /**
     * 本月活跃用户数据
     *
     * @param startTime     //当前的开始时间
     * @param endTime       //当前的结束时间
     * @param lastStartTime //一年前的开始时间
     * @param lastEndTime   //一年前的开始时间
     * @return
     */
    /*private UsersVo getActiveUserMonth(Date startTime, Date endTime, Date lastStartTime, Date lastEndTime) {
        //创建返回对象
        UsersVo usersVo = new UsersVo();

        //今年新增用户数据
        List<Managelogs> managelogsList = this.dashboardApi.getManagelogsList(startTime.getTime(), endTime.getTime());

        //按照一月30天遍历查询,如果月份日期和User创建的月份日期相同 amount+1
        List<DateNumberVo> thisYear = new ArrayList<>();
        for (int i = 1; i <= 31; i++) {
            DateNumberVo dateNumberVo = new DateNumberVo();
            Integer amount = 0;
            for (Managelogs managelogs : managelogsList) {
                String dd1 = DateUtil.format(DateUtil.date(managelogs.getLogTime()), "MM-dd");
                String dd2 = DateUtil.format(startTime, "MM-dd");
                if (StrUtil.equals(dd1, dd2)) {
                    amount++;
                }
            }
            String format = DateUtil.format(startTime, "MM-dd");
            dateNumberVo.setTitle(format);
            dateNumberVo.setAmount(amount);
            thisYear.add(dateNumberVo);
            startTime = DateUtil.offsetDay(startTime, 1);
        }
        usersVo.setThisYear(thisYear);

        //去年新增用户数据
        List<Managelogs> lastManagelogsList = this.dashboardApi.getManagelogsList(lastStartTime.getTime(), lastEndTime.getTime());

        //按照一月30天遍历查询,如果月份日期和User创建的月份日期相同 amount+1
        List<DateNumberVo> lastYear = new ArrayList<>();
        for (int i = 1; i <= 31; i++) {
            DateNumberVo dateNumberVo = new DateNumberVo();
            Integer amount = 0;
            for (Managelogs managelogs : lastManagelogsList) {
                String dd1 = DateUtil.format(DateUtil.date(managelogs.getLogTime()), "MM-dd");
                String dd2 = DateUtil.format(lastStartTime, "MM-dd");
                if (StrUtil.equals(dd1, dd2)) {
                    amount++;
                }
            }
            String format = DateUtil.format(lastStartTime, "MM-dd");
            dateNumberVo.setTitle(format);
            dateNumberVo.setAmount(amount);
            lastYear.add(dateNumberVo);
            lastStartTime = DateUtil.offsetDay(lastStartTime, 1);
        }
        usersVo.setLastYear(lastYear);

        return usersVo;
    }*/

}
